qinglan.Canvas.SpellCard = qinglan.Canvas.RenderInterface.extend(function(id) {

	this.id = id;

	this.__useSelfRender = true;

	this.trajectorys = {};

	this.bulletHelpers = {};

	this.opt = {};

}).methods({
	init: function(){
		var opt = this.opt;
		opt.start = qinglan.Canvas.Const.deg2rad(opt.start);
		opt.end = qinglan.Canvas.Const.deg2rad(opt.end);
		opt.sub = Math.abs(opt.end - opt.start);
		opt.mid = opt.way / 2;
		opt.split =  (opt.sub || 0) / (opt.way > 1 ? (opt.way - 1) : 1);
	},
	setOption: function(opt){
		this.opt = qinglan.Extend.simple({
			start: 30,
			end: 60,
			way: 3,
			num: 3,
			mode: qinglan.Canvas.ParSpread.assemble
		}, opt, 1);
		this.init();
	},
	getOption: function(){
		return this.opt;
	},
	addTrajectorys: function(trajectorys){
		qinglan.Type.isArray(trajectorys) ? qinglan.Array.each(trajectorys,function(trajectory){
			this.trajectorys[trajectory.id] = trajectory;
		},this) : (this.trajectorys[trajectorys.id] = trajectorys);
	},
	addBulletHelper: function(bulletHelpers){
		qinglan.Type.isArray(bulletHelpers) ? qinglan.Array.each(bulletHelpers,function(bulletHelper){
			this.bulletHelpers[bulletHelper.id] = bulletHelper;
		},this) : (this.bulletHelpers[bulletHelpers.id] = bulletHelpers);
	},
	update: function(ctx) {
		qinglan.Object.each(this.trajectorys, function(trajectory){
			trajectory.update(ctx);
		});
	},
	draw: function(ctx) {
		 qinglan.Object.each(this.trajectorys, function(trajectory){
		 	trajectory.draw(ctx);
		 });
	},
	destory: function() {
		 qinglan.Object.each(this.trajectorys, function(trajectory){
		 	trajectory.destory();
		 })
	}
});
